package cn.zwx.search.controller;

import cn.zwx.search.annotation.Document;
import cn.zwx.search.common.ResponseMsg;
import cn.zwx.search.model.Sort;
import cn.zwx.search.model.req.OrderInfoReq;
import cn.zwx.search.model.resp.OrderInfoResp;
import cn.zwx.search.service.QueryOrderService;
import cn.zwx.search.utils.ValidatorUtils;
import com.alibaba.fastjson.JSON;
import com.github.pagehelper.PageInfo;
import com.sun.org.apache.regexp.internal.RE;
import org.elasticsearch.search.sort.SortOrder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * @description:
 * @projectName:search-example
 * @see:cn.zwx.search.controller
 * @author:zhangwenxue
 * @createTime:2020/10/24 10:15
 * @version:1.0
 */
@RestController
@RequestMapping("/order")
public class OrderController {

    @Autowired
    private QueryOrderService queryOrderService;

    /**
     * @description 订单主搜索
     * @return java.lang.String
     * @author zhangwenxue
     * @createTime 2020/10/23 15:55
     **/
    @RequestMapping(value = "/page/list",method = RequestMethod.POST)
   public ResponseMsg<PageInfo<OrderInfoResp>> mainSearch(@RequestBody OrderInfoReq req){
         //校验参数
        ValidatorUtils.validateEntity(req);
        //请求接口
        PageInfo<OrderInfoResp> pageInfo = queryOrderService.mainSearch(req);
        //返回参数
        return ResponseMsg.success(pageInfo);

    }

}
